USE OilManagementStore1;

DROP TABLE Receipts;

CREATE TABLE dbo.Receipts (
	ID			UNIQUEIDENTIFIER DEFAULT NEWID() PRIMARY KEY,			
	ReceiptNumber	NVARCHAR(30) NOT NULL,
	StoreID		UNIQUEIDENTIFIER REFERENCES Stores(ID) NOT NULL,
	ReceiptTime SMALLDATETIME NOT NULL DEFAULT GETDATE(),
	Company		NVARCHAR(200) NOT NULL,
	CompanyAddress NVARCHAR(500) NOT NULL,
	TaxCode		NVARCHAR(30) NOT NULL,
	Product		UNIQUEIDENTIFIER REFERENCES Products(ID) NOT NULL,
	Price		MONEY NOT NULL CHECK (Price >= 0),
	Fee			MONEY NOT NULL,
	Amount		DECIMAL(15, 2) NOT NULL CHECK(Amount >= 0)
);
GO